#include<bits/stdc++.h>
using namespace std;
int t[10000000],w[10000000];
int m,n,s,i,d;
int main() {
	cin >> m >> n;
	for(i = 1;i <= m;i++) scanf("%d",&t[i]); 
	for(i = 1;i <= n;i++) scanf("%d",&w[i]); 
	sort(t+1,t+1+m);
	sort(w+1,w+1+n);
	d=1;
	for(i = 1;i <= n;i++) {
		if(t[d] == 0) d++;
		if(t[d] < w[i] && t[d] != 0) {
			w[i] = 0;    
			d++;
		}
	}
	if(d <= m) {
		cout << 0;    
		return 0;
	}
	for(i = 1;i <= n;i++)s += w[i];
	cout << s;
}

